package handlerListen.util;


import com.nf.Annotation.ClassAnnotation;

public class ToSimpleName {
    public static String toString(Class<?> clazz){
        String beanName=null;
        if(clazz.isAnnotationPresent(ClassAnnotation.class)){
            beanName = clazz.getAnnotation(ClassAnnotation.class).value();
            if(beanName.equals("")){
                beanName = toLowerBeanName((clazz.getSimpleName()));
            }
        }else {
            beanName = toLowerBeanName((clazz.getSimpleName()));
        }
        return beanName;
    }
    private static String toLowerBeanName(String beanName) {
        beanName = beanName.substring(0, 1).toLowerCase()
                + beanName.substring(1);
        return beanName;
    }
}
